package com.company.pangu.sensitive.strategy;

import com.company.pangu.sensitive.enums.SensitiveDefaultLengthEnum;
import com.company.pangu.sensitive.util.SensitiveInfoUtils;

/**
 * 银行卡号脱敏
 *
 * @author youyoukele
 * @version 1.0
 * @date 2022/09/05 10:34
 */
public class SensitiveBankCard implements IStrategy {

    @Override
    public String desensitization(String bankCard, int begin, int end) {
        if (begin != SensitiveDefaultLengthEnum.BANKCARD.getBegin() && begin != 0 &&
                end != SensitiveDefaultLengthEnum.BANKCARD.getEnd() && end != 0) {
            return SensitiveInfoUtils.bankCard(bankCard, begin, end);
        }
        return SensitiveInfoUtils.bankCard(bankCard, SensitiveDefaultLengthEnum.BANKCARD.getBegin(), SensitiveDefaultLengthEnum.BANKCARD.getEnd());
    }

}
